﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="SchemeAuditView.aspx.cs" Inherits="SkWeb.FASJ.SchemeAuditView" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>方案审核</title>
    <link href="../easyui/themes/icon.css" rel="stylesheet" type="text/css" />
    <link href="../easyui/themes/default/easyui.css" rel="stylesheet" type="text/css" />
    <script src="../easyui/jquery-1.8.0.min.js" type="text/javascript"></script>
    <script src="../easyui/jquery.easyui.min.js" type="text/javascript"></script>
    <script type="text/javascript">

       var selFA_id=' ';
       var selRmk=' ';

        function showLog(objId) {
            $("#winLog").window("open");
            $("#dgLog").datagrid({
                url: '../Handlers/SchemeAuditHandler.aspx?op=getworkflowlog&objid=' + objId.toString(),
                columns: [[
                    { field: 'FROMSTATUS', title: '审核节点', width: 70,
                        formatter: function (value, rowData, rowIndex) {
                            if (value == 0)
                                return "初审";
                            else if (value == 1)
                                return "复审";
                            else if (value == 2)
                                return "终审";
                        }
                    },
                    { field: 'USE_NAME', title: '审核人', width: 100 },
                    { field: 'SH_TIME', title: '审核时间', width: 100 },
                    { field: 'SH_OP_NAME', title: '审核操作', width: 100 },
                    { field: 'SH_RMK', title: '审核意见', width: 200 }
                ]]
            });
        }

        function openAudit(objId) {
            //TODO 在此处添加弹出审核对话框
            //$.messager.alert("提示框", "请在js部分的openAudit方法中添加审核对话框代码");
            selFA_id=objId;
            document.getElementById("frame").src = "../FAXZ/WordBrowse.aspx?op=sh&id=" + objId;
            $('#w').window('open');
        }

        $(function () {

            $("#winLog").window("close");

            $("#dgWait").datagrid({
                url: '../Handlers/SchemeAuditHandler.aspx?op=getwait',
                columns: [[

                    { field: 'JH', title: '井号', width: 100 },
                    { field: 'TMP_MC', title: '方案名称', width: 200 },
                    { field: 'SJR', title: '设计人' },
                    { field: 'SJRQ', title: '设计时间' },
                    {
                        title: '操作', field: 'ID',
                        formatter: function (value, rowData, rowIndex) {
                            if (value) {
                                return "<a href='#' onclick='showLog(" + value + ")' >查看</a>" + "&nbsp;<a href='#' onclick='openAudit(" + value + ")' >审核</a>";
                            }
                            else {
                                return "";
                            }
                        }
                    }
                ]],
                pagination: true,
                pageSize: 15,
                singleSelect: true,
                loadMsg: '数据加载中......',
                rownumbers: true,
                method: "post"
            });

            //设置分页控件  
            var pwait = $('#dgWait').datagrid('getPager');
            $(pwait).pagination({
                pageSize: 15, //每页显示的记录条数，默认为10  
                pageList: [10, 15, 20], //可以设置每页记录条数的列表  
                beforePageText: '第', //页数文本框前显示的汉字  
                afterPageText: '页    共 {pages} 页',
                displayMsg: ''
                /*displayMsg: '当前显示 {from} - {to} 条记录   共 {total} 条记录'
                */
            });

            $("#dgDone").datagrid({
                url: '../Handlers/SchemeAuditHandler.aspx?op=getdone',
                columns: [[
                    { field: 'JH', title: '井号', width: 100 },
                    { field: 'TMP_MC', title: '方案名称', width: 200 },
                    { field: 'SJR', title: '设计人', width: 80 },
                    { field: 'SH_TIME', title: '审核时间', width: 100 },
                    { field: 'SH_OP_NAME', title: '审核操作', width: 100 },
                    { field: 'SH_RMK', title: '审核意见', width: 200 },
                    {
                        title: '操作', field: 'ID', width:40,
                        formatter: function (value, rowData, rowIndex) {
                            if (value) {
                                return "<a href='#' onclick='showLog("+ value +")' >查看</a>";
                            }
                            else {
                                return "";
                            }
                        }
                    }
                ]],
                pagination: true,
                pageSize: 15,
                singleSelect: true,
                loadMsg: '数据加载中......',
                rownumbers: true,
                method: "post"
            });

            //设置分页控件  
            var pdone = $('#dgDone').datagrid('getPager');
            $(pdone).pagination({
                pageSize: 15, //每页显示的记录条数，默认为10  
                pageList: [10, 15, 20], //可以设置每页记录条数的列表  
                beforePageText: '第', //页数文本框前显示的汉字  
                afterPageText: '页    共 {pages} 页',
                displayMsg: ''
                /*displayMsg: '当前显示 {from} - {to} 条记录   共 {total} 条记录'
                */
            });
        });









        $(function () {

            $("#aSubmitSave").click(function () {

                var str = document.getElementById("frame").src;
                if (str.indexOf("Word") >= 0) {
                    window.frames["frame"].SaveFile();
                    alert("保存成功！");
                }
                else {
                    window.frames["frame"].save();
                    alert("保存成功！");
                }


            });
            $("#aPass").click(function () {
                $.post('../Handlers/SchemeAuditHandler.aspx?op=pass', { opname: '通过', fromstatus: 0, objid: selFA_id, rmk: selRmk }, function (data, textStatus) {
                    alert('审核完成');
                  //  $.messager.alert("提示框", data);
                });

            });


            $("#aUnpass").click(function () {

                $.post('../Handlers/SchemeAuditHandler.aspx?op=back', { opname: '未通过', fromstatus: 0, objid: selFA_id, rmk: selRmk }, function (data, textStatus) {
                    alert('审核完成');
                });

            });
            $("#aClose").click(function () {
                $('#w').window('close');

            });

            $('#w').dialog({
                onClose: function () {
                    document.getElementById("frame").src = "#";

                }
            });

        });



    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div class="easyui-tabs">
        <div title="待审方案" style="padding:1px;">
            <table id="dgWait" style=" height:400px; border-bottom-width:0">
                
            </table>
        </div>
        <div title="已审方案" style="padding:1px;">
            <table id="dgDone" style=" height:400px;">
            </table>
        </div>
    </div>
    <div id="winLog" class="easyui-window" title="审核流程明细" style="width:600px; height:450px; padding:1px;"
     data-options="iconCls:'icon-save', modal:true, collapsible:false, minimizable:false,maximizable:false">
        <table id="dgLog" style=" height:100%;" data-options="fitColumns:true">
        	
        </table>
    </div>










	<div id="w" class="easyui-dialog" title="手动修改" data-options="iconCls:'icon-edit',closed:true,toolbar: '#dlg-toolbar'"  style= "width:920px;height:650px;padding:0px; z-index:10000000">
    <div id="dlg-toolbar" style="padding:2px 0">
		<table cellpadding="0" cellspacing="0" style="width:100%">
			<tr>
				<td style="padding-left:2px">
					<a href="javascript:void(0)" id="aSubmitSave" class="easyui-linkbutton" data-options="iconCls:'icon-save',plain:true">保存</a>
					<a href="javascript:void(0)" id="aClose" class="easyui-linkbutton" data-options="iconCls:'icon-cancel',plain:true">关闭</a>
				    <a href="javascript:void(0)" id="aPass" class="easyui-linkbutton" iconCls="icon-ok" >通过</a>
                    <a href="javascript:void(0)" id="aUnpass" class="easyui-linkbutton" iconCls="icon-cancel" >未通过</a>
    </div>
                
                </td>
				<td style="text-align:right;padding-right:2px">
					<input class="easyui-searchbox" data-options="prompt:'Please input somthing'" style="width:150px"></input>
				</td>
			</tr>
		</table>
	</div>
    <div  style="padding:0px;">  
				   
                <iframe src="#" id="frame"  width="100%" height="100%" scrolling="no" style=" padding:0px"></iframe>
			</div>
	<%--	<div class="easyui-layout" data-options="fit:true">
			<div data-options="region:'west',split:true" style="width:250px">

            <table id="Table1" title="超链接管理" class="easyui-datagrid" style="width:250px;height:650px"
            url="get_users.php"
            toolbar="#toolbar" pagination="false"
            rownumbers="true" fitColumns="false" singleSelect="true">
        <thead>
            <tr>
                <th field="firstname" width="150px">文本</th>
                <th field="lastname" width="50px">行号</th>
              
            </tr>
        </thead>
    </table>
    <div id="toolbar">
        <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-add" plain="true" onclick="newHyperLink()">New</a>
        <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-edit" plain="true" onclick="editHyperLink()">Edit</a>
        <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-remove" plain="true" onclick="destroyHyperLink()">Remove</a>
    </div>
    
   <div id="dlg" class="easyui-dialog" style="width:400px;height:180px;padding:10px 20px; z-index:10000"
            closed="true" buttons="#dlg-buttons">
        <div class="ftitle">HyperLink Information</div>
        <form id="fm" method="post" novalidate>
            <div class="fitem">
                <label>选择行:</label>
                <input name="firstname" class="easyui-validatebox" required="true">
            </div>
            <div class="fitem">
                <label>文本内容:</label>
                <input name="lastname" class="easyui-validatebox" required="true">
            </div>
           
        </form>
    </div>
    <div id="Div1">
        <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-ok" onclick="saveUser()">Save</a>
        <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-cancel" onclick="javascript:$('#dlg').dialog('close')">Cancel</a>
    </div>
   

   </div>


			<div data-options="region:'center'" style="padding:0px;">
				
                <iframe src="#" id="frame"  width="100%" height="100%"></iframe>
			</div>
			<div data-options="region:'south',border:false" style="text-align:right;padding:0px;">
				<a class="easyui-linkbutton" data-options="iconCls:'icon-ok'" href="javascript:void(0)" onclick="javascript:alert('ok')">Ok</a>
				<a class="easyui-linkbutton" data-options="iconCls:'icon-cancel'" href="javascript:void(0)" onclick="javascript:alert('cancel')">Cancel</a>
			</div>
		</div>--%>
	</div>






    </form>
</body>
</html>
